package br.com.mtg.movethegarbage.game;

import java.util.Random;

import br.com.mtg.movethegarbage.framework.Game;

public class Levels
{
	public static short[][] tutorial = { { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 3, 3, 3, 3, 3, 3, 3, 3, 2 }, { 2, 3, 3, 3, 3, 3, 3, 3, 3, 2 },
			{ 2, 3, 3, 1503, 3, 1003, 3, 53, 3, 2 }, { 2, 3, 3, 3, 3, 3, 3, 3, 3, 2 }, { 2, 3, 3, 3, 3, 3, 3, 3, 3, 2 }, { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 } };

	public static short[][] level1 = { { 4, 4, 2, 2, 2, 4, 4, 4 }, { 4, 1, 2, 53, 2, 1, 1, 4 }, { 4, 1, 2, 3, 2, 2, 2, 2 }, { 2, 2, 2, 1003, 3, 1003, 53, 2 },
			{ 2, 53, 3, 1003, 1503, 2, 2, 2 }, { 2, 2, 2, 2, 1003, 2, 1, 4 }, { 4, 1, 1, 2, 53, 2, 1, 4 }, { 4, 4, 4, 2, 2, 2, 4, 4 } };

	public static short[][] level2 = { { 1, 2, 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 3, 3, 3, 3, 53, 2, 53, 2, 2 }, { 2, 3, 3, 3, 2, 2, 2, 3, 2, 2 },
			{ 2, 3, 3, 3, 3, 3, 1003, 3, 3, 2 }, { 2, 3, 3, 3, 2, 3, 2, 3, 3, 2 }, { 2, 3, 3, 3, 3, 1003, 3, 3, 3, 2 }, { 2, 1503, 2, 3, 3, 3, 3, 3, 3, 2 },
			{ 4, 2, 2, 2, 2, 2, 2, 2, 2, 2 } };

	public static short[][] level3 = { { 2, 2, 2, 1, 4, 1, 1 }, { 2, 53, 2, 2, 2, 2, 2 }, { 2, 53, 53, 3, 3, 3, 2 }, { 2, 3, 1003, 1003, 1003, 1503, 2 },
			{ 2, 3, 3, 3, 3, 2, 2 }, { 2, 2, 2, 2, 2, 2, 4 } };

	public static short[][] level4 = { { 2, 2, 2, 2, 2, 2, 2, 1 }, { 2, 53, 3, 3, 1503, 53, 2, 4 }, { 2, 3, 3, 1003, 2, 3, 2, 2 },
			{ 2, 3, 2, 3, 1003, 53, 3, 2 }, { 2, 3, 3, 3, 1003, 2, 3, 2 }, { 2, 2, 2, 2, 3, 3, 3, 2 }, { 1, 4, 1, 2, 2, 2, 2, 2 } };

	public static short[][] level5 = { { 4, 1, 2, 2, 2, 2, 1, 4 }, { 1, 1, 2, 3, 1503, 2, 2, 2 }, { 4, 1, 2, 1103, 1103, 3, 3, 2 },
			{ 2, 2, 2, 3, 1103, 63, 3, 2 }, { 2, 63, 63, 63, 3, 2, 2, 2 }, { 2, 2, 2, 1103, 3, 2, 4, 1 }, { 1, 4, 2, 3, 3, 2, 4, 1 },
			{ 1, 4, 2, 2, 2, 2, 1, 1 } };

	public static short[][] level6 = { { 2, 2, 2, 2, 2, 1, 1, 4 }, { 2, 3, 3, 3, 2, 2, 2, 1 }, { 2, 3, 2, 3, 63, 1503, 2, 2 },
			{ 2, 3, 3, 63, 1103, 1103, 3, 2 }, { 2, 2, 2, 1103, 3, 3, 3, 2 }, { 4, 1, 2, 3, 3, 3, 63, 2 }, { 4, 4, 2, 2, 2, 2, 2, 2 } };

	public static short[][] level7 = { { 2, 2, 2, 2, 4, 4 }, { 2, 3, 63, 2, 1, 1 }, { 2, 3, 3, 2, 2, 2 }, { 2, 1163, 1503, 3, 3, 2 },
			{ 2, 3, 3, 1103, 3, 2 }, { 2, 3, 3, 2, 2, 2 }, { 2, 2, 2, 2, 1, 4 } };

	public static short[][] level8 = { { 2, 2, 2, 2, 2, 2, 2, 2 }, { 2, 63, 3, 3, 3, 63, 3, 2 }, { 2, 3, 2, 3, 2, 3, 3, 2 },
			{ 2, 1503, 1103, 3, 3, 1103, 63, 2 }, { 2, 2, 2, 2, 2, 3, 1103, 2 }, { 1, 4, 4, 1, 2, 3, 3, 2 }, { 1, 1, 1, 1, 2, 2, 2, 2 } };

	public static short[][] level9 = { { 4, 1, 4, 2, 2, 2, 2 }, { 2, 2, 2, 2, 3, 1503, 2 }, { 2, 3, 1203, 73, 1203, 3, 2 }, { 2, 3, 3, 3, 3, 3, 2 },
			{ 2, 2, 3, 73, 2, 2, 2 }, { 1, 2, 1203, 3, 2, 1, 4 }, { 4, 2, 3, 73, 2, 4, 1 }, { 1, 2, 2, 2, 2, 1, 4 } };

	public static short[][] level10 = { { 1, 4, 2, 2, 2, 2, 4, 1, 1 }, { 2, 2, 2, 3, 3, 2, 2, 2, 2 }, { 2, 3, 3, 3, 3, 3, 1203, 3, 2 },
			{ 2, 3, 2, 3, 3, 2, 1203, 3, 2 }, { 2, 3, 73, 3, 73, 2, 1503, 3, 2 }, { 2, 2, 2, 2, 2, 2, 2, 2, 2 } };

	public static short[][] level11 = { { 4, 2, 2, 2, 2, 2, 2, 4 }, { 2, 2, 1503, 73, 3, 3, 2, 4 }, { 2, 3, 1203, 1203, 1273, 3, 2, 4 },
			{ 2, 3, 3, 2, 3, 3, 2, 2 }, { 2, 3, 3, 2, 3, 3, 73, 2 }, { 2, 2, 2, 2, 3, 2, 3, 2 }, { 4, 1, 1, 2, 3, 3, 3, 2 }, { 4, 1, 4, 2, 2, 2, 2, 2 } };

	public static short[][] level12 = { { 1, 2, 2, 2, 2, 4, 4, 4 }, { 4, 2, 1503, 3, 2, 1, 4, 4 }, { 1, 2, 3, 3, 2, 1, 1, 4 }, { 2, 2, 73, 3, 2, 2, 2, 2 },
			{ 2, 3, 1203, 1203, 73, 3, 73, 2 }, { 2, 3, 3, 1203, 3, 2, 2, 2 }, { 2, 2, 2, 3, 3, 2, 4, 1 }, { 1, 4, 2, 2, 2, 2, 1, 4 } };

	public static short[][] level13 = { { 4, 2, 2, 2, 2, 1, 4, 1 }, { 2, 2, 3, 3, 2, 2, 2, 1 }, { 2, 3, 3, 3, 3, 3, 2, 2 }, { 2, 3, 3, 2, 1303, 1303, 1503, 2 },
			{ 2, 3, 3, 83, 3, 1383, 83, 2 }, { 2, 2, 2, 2, 2, 2, 2, 2 } };

	public static short[][] level14 = { { 4, 4, 2, 2, 2, 2, 1, 4 }, { 4, 1, 2, 3, 3, 2, 1, 1 }, { 4, 1, 2, 3, 3, 2, 2, 2 }, { 2, 2, 2, 3, 83, 83, 3, 2 },
			{ 2, 3, 3, 1303, 2, 3, 3, 2 }, { 2, 3, 3, 83, 1303, 1303, 3, 2 }, { 2, 2, 2, 2, 3, 1503, 3, 2 }, { 1, 4, 1, 2, 2, 2, 2, 2 } };

	public static short[][] level15 = { { 4, 2, 2, 2, 2, 2, 2, 4 }, { 4, 2, 1503, 3, 3, 3, 2, 2 }, { 4, 2, 2, 1303, 3, 3, 3, 2 }, { 2, 2, 2, 3, 83, 3, 3, 2 },
			{ 2, 3, 1303, 3, 2, 1303, 2, 2 }, { 2, 3, 83, 3, 3, 83, 2, 1 }, { 2, 2, 2, 2, 3, 3, 2, 1 }, { 1, 4, 1, 2, 2, 2, 2, 1 } };

	public static short[][] level16 = { { 4, 4, 1, 1, 2, 2, 2, 2 }, { 4, 4, 1, 4, 2, 1503, 3, 2 }, { 2, 2, 2, 2, 2, 3, 83, 2 },
			{ 2, 3, 1303, 3, 1303, 3, 1303, 2 }, { 2, 3, 3, 3, 83, 3, 3, 2 }, { 2, 2, 2, 3, 83, 3, 3, 2 }, { 1, 4, 2, 2, 2, 2, 2, 2 } };

	public static short[][] level17 = { { 2, 2, 2, 2, 2, 2, 1, 4 }, { 2, 3, 93, 3, 3, 2, 4, 1 }, { 2, 3, 93, 2, 3, 2, 2, 2 },
			{ 2, 3, 1503, 1403, 1403, 3, 3, 2 }, { 2, 3, 1403, 93, 3, 3, 3, 2 }, { 2, 2, 2, 2, 2, 2, 2, 2 } };

	public static short[][] level18 = { { 2, 2, 2, 2, 2, 2, 1 }, { 2, 3, 93, 3, 3, 2, 4 }, { 2, 3, 3, 2, 1503, 2, 1 }, { 2, 3, 3, 1403, 3, 2, 2 },
			{ 2, 2, 1403, 2, 3, 3, 2 }, { 2, 3, 3, 3, 2, 3, 2 }, { 2, 93, 3, 1493, 3, 3, 2 }, { 2, 2, 2, 2, 2, 2, 2 } };

	public static short[][] level19 = { { 1, 1, 1, 2, 2, 2, 2, 2 }, { 2, 2, 2, 2, 93, 3, 1503, 2 }, { 2, 3, 3, 93, 1403, 3, 3, 2 },
			{ 2, 3, 2, 3, 3, 2, 2, 2 }, { 2, 3, 1403, 3, 1403, 3, 93, 2 }, { 2, 2, 2, 2, 3, 3, 3, 2 }, { 4, 4, 4, 2, 2, 2, 2, 2 }, };

	public static short[][] level20 = { { 4, 1, 4, 1, 4, 4, 2, 2, 2, 2 }, { 4, 1, 1, 4, 2, 2, 2, 93, 93, 2 }, { 1, 4, 4, 1, 2, 3, 3, 93, 93, 2 },
			{ 1, 4, 4, 1, 2, 3, 3, 1403, 3, 2 }, { 2, 2, 2, 2, 2, 2, 3, 2, 2, 2 }, { 2, 1503, 3, 3, 3, 3, 3, 2, 2, 2 }, { 2, 2, 3, 2, 3, 1403, 3, 1403, 3, 2 },
			{ 1, 2, 3, 1403, 3, 2, 3, 2, 3, 2 }, { 4, 2, 3, 3, 3, 2, 3, 3, 3, 2 }, { 4, 2, 2, 2, 2, 2, 2, 2, 2, 2 } };

	public static String getHint(Game game, int _map)
	{
		switch (_map)
		{
			case 0:
				return game.getStringFromResource(R.string.hint1);
			case 1:
				return game.getStringFromResource(R.string.hint1);
			case 5:
				return game.getStringFromResource(R.string.hint2);
			case 9:
				return game.getStringFromResource(R.string.hint3);
			case 13:
				return game.getStringFromResource(R.string.hint4);
			case 17:
				return game.getStringFromResource(R.string.hint5);
		}
		return randomizeHint(game);
	}

	private static String randomizeHint(Game game)
	{
		int rand = Math.round((new Random(System.currentTimeMillis())).nextFloat() * 16);
		switch (rand)
		{
			case 0:
				return game.getStringFromResource(R.string.hint6);
			case 1:
				return game.getStringFromResource(R.string.hint7);
			case 2:
				return game.getStringFromResource(R.string.hint8);
			case 3:
				return game.getStringFromResource(R.string.hint9);
			case 4:
				return game.getStringFromResource(R.string.hint10);
			case 5:
				return game.getStringFromResource(R.string.hint11);
			case 6:
				return game.getStringFromResource(R.string.hint12);
			case 7:
				return game.getStringFromResource(R.string.hint13);
			case 8:
				return game.getStringFromResource(R.string.hint14);
			case 9:
				return game.getStringFromResource(R.string.hint15);
			case 10:
				return game.getStringFromResource(R.string.hint16);
			case 11:
				return game.getStringFromResource(R.string.hint17);
			case 12:
				return game.getStringFromResource(R.string.hint18);
			case 13:
				return game.getStringFromResource(R.string.hint19);
			case 14:
				return game.getStringFromResource(R.string.hint20);
			case 15:
				return game.getStringFromResource(R.string.hint21);
			case 16:
				return game.getStringFromResource(R.string.hint22);
		}
		return "";
	}

	public static Map getMap(int _map)
	{
		switch (_map)
		{
			case 0:
				return new Map(tutorial, tutorial.length, tutorial[0].length, null);
			case 1:
				return new Map(level1, level1.length, level1[0].length, null);
			case 2:
				return new Map(level2, level2.length, level2[0].length, null);
			case 3:
				return new Map(level3, level3.length, level3[0].length, null);
			case 4:
				return new Map(level4, level4.length, level4[0].length, null);
			case 5:
				return new Map(level5, level5.length, level5[0].length, null);
			case 6:
				return new Map(level6, level6.length, level6[0].length, null);
			case 7:
				return new Map(level7, level7.length, level7[0].length, null);
			case 8:
				return new Map(level8, level8.length, level8[0].length, null);
			case 9:
				return new Map(level9, level9.length, level9[0].length, null);
			case 10:
				return new Map(level10, level10.length, level10[0].length, null);
			case 11:
				return new Map(level11, level11.length, level11[0].length, null);
			case 12:
				return new Map(level12, level12.length, level12[0].length, null);
			case 13:
				return new Map(level13, level13.length, level13[0].length, null);
			case 14:
				return new Map(level14, level14.length, level14[0].length, null);
			case 15:
				return new Map(level15, level15.length, level15[0].length, null);
			case 16:
				return new Map(level16, level16.length, level16[0].length, null);
			case 17:
				return new Map(level17, level17.length, level17[0].length, null);
			case 18:
				return new Map(level18, level18.length, level18[0].length, null);
			case 19:
				return new Map(level19, level19.length, level19[0].length, null);
			case 20:
				return new Map(level20, level20.length, level20[0].length, null);
		}
		return null;
	}
}
